/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package toesp.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author satria.sp
 */
@Entity
@Table(name = "mhs")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Mhs.findAll", query = "SELECT m FROM Mhs m")})
public class Mhs implements Serializable {
    @Column(name = "mhs_lulus")
    @Temporal(TemporalType.TIMESTAMP)
    private Date mhsLulus;
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "mhs_npm")
    private String mhsNpm;
    @Basic(optional = false)
    @Column(name = "mhs_nama")
    private String mhsNama;
    //--------------------------------------------------------------------------
    @Basic(optional = false)
    @Column(name = "jurusan_id")
    private String jurusanId;
    //--------------------------------------------------------------------------
    @Column(name = "mhs_kelas")
    private Character mhsKelas;
    @Column(name = "mhs_kelascaption")
    private String mhsKelascaption;
    @Column(name = "mhs_tahun")
    private String mhsTahun;
    @Column(name = "mhs_alamat")
    private String mhsAlamat;
    @Column(name = "mhs_nohp")
    private String mhsNohp;
    @OneToMany(mappedBy = "mhs")
    private List<Pendaftaran> pendaftaranList;
    @JoinColumn(name = "jurusan_id", referencedColumnName = "jurusan_id", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Jurusan jurusan;
    @OneToMany(mappedBy = "mhs")
    private List<Asisten> asistenList;

    public Mhs() {
    }

    public Mhs(String mhsNpm) {
        this.mhsNpm = mhsNpm;
    }

    public Mhs(String mhsNpm, String mhsNama) {
        this.mhsNpm = mhsNpm;
        this.mhsNama = mhsNama;
    }

    public String getMhsNpm() {
        return mhsNpm;
    }

    public void setMhsNpm(String mhsNpm) {
        this.mhsNpm = mhsNpm;
    }

    public String getMhsNama() {
        return mhsNama;
    }

    public void setMhsNama(String mhsNama) {
        this.mhsNama = mhsNama;
    }

    public Character getMhsKelas() {
        return mhsKelas;
    }

    public void setMhsKelas(Character mhsKelas) {
        this.mhsKelas = mhsKelas;
    }

    public String getMhsKelascaption() {
        return mhsKelascaption;
    }

    public void setMhsKelascaption(String mhsKelascaption) {
        this.mhsKelascaption = mhsKelascaption;
    }

    public String getMhsTahun() {
        return mhsTahun;
    }

    public void setMhsTahun(String mhsTahun) {
        this.mhsTahun = mhsTahun;
    }

    public String getMhsAlamat() {
        return mhsAlamat;
    }

    public void setMhsAlamat(String mhsAlamat) {
        this.mhsAlamat = mhsAlamat;
    }

    public Date getMhsLulus() {
        return mhsLulus;
    }

    public void setMhsLulus(Date mhsLulus) {
        this.mhsLulus = mhsLulus;
    }

    public String getMhsNohp() {
        return mhsNohp;
    }

    public void setMhsNohp(String mhsNohp) {
        this.mhsNohp = mhsNohp;
    }

    @XmlTransient
    public List<Pendaftaran> getPendaftaranList() {
        return pendaftaranList;
    }

    public void setPendaftaranList(List<Pendaftaran> pendaftaranList) {
        this.pendaftaranList = pendaftaranList;
    } 

    @XmlTransient
    public List<Asisten> getAsistenList() {
        return asistenList;
    }

    public void setAsistenList(List<Asisten> asistenList) {
        this.asistenList = asistenList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (mhsNpm != null ? mhsNpm.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Mhs other = (Mhs) obj;
        if ((this.mhsNpm == null) ? (other.mhsNpm != null) : !this.mhsNpm.equals(other.mhsNpm)) {
            return false;
        }
        if ((this.jurusanId == null) ? (other.jurusanId != null) : !this.jurusanId.equals(other.jurusanId)) {
            return false;
        }
        return true;
    }

    /**
     * @return the jurusanId
     */
    public String getJurusanId() {
        return jurusanId;
    }

    /**
     * @param jurusanId the jurusanId to set
     */
    public void setJurusanId(String jurusanId) {
        this.jurusanId = jurusanId;
    }

    /**
     * @return the jurusan
     */
    public Jurusan getJurusan() {
        return jurusan;
    }

    /**
     * @param jurusan the jurusan to set
     */
    public void setJurusan(Jurusan jurusan) {
        this.jurusan = jurusan;
    }  
}
